home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Periodicals / develop / develop Issue 9 / develop 9 code / TermWindow / SampleTermWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-06  |  7.6 KB  |  177 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2. **
  3. **  Project Name:    SampleTermWindow
  4. **     File Name:    SampleTermWindow.h
  5. **
  6. **   Description:    Contains common defines for application and .r file.
  7. **
  8. **                       Copyright © 1988-1991 Apple Computer, Inc.
  9. **                       All rights reserved.
  10. **
  11. *******************************************************************************
  12. **                       A U T H O R   I D E N T I T Y
  13. *******************************************************************************
  14. **
  15. **    Initials    Name
  16. **    --------    -----------------------------------------------
  17. **    CSH            Craig Hotchkiss
  18. **
  19. *******************************************************************************
  20. **                      R E V I S I O N   H I S T O R Y
  21. *******************************************************************************
  22. **
  23. ******************************************************************************/
  24.  
  25.  
  26. /*    These #defines correspond to values defined in the Pascal source code.
  27.     Sample.c and Sample.r include this file. */
  28.  
  29. /*    Determining an application's minimum size to request from MultiFinder depends
  30.     on many things, each of which can be unique to an application's function,
  31.     the anticipated environment, the developer's attitude of what constitutes
  32.     reasonable functionality and performance, etc. Here is a list of some things to
  33.     consider when determining the minimum size (and preferred size) for your
  34.     application. The list is pretty much in order of importance, but by no means
  35.     complete.
  36.     
  37.     1.    What is the minimum size needed to give almost 100 percent assurance
  38.         that the application won't crash because it ran out of memory? This
  39.         includes not only things that you do have direct control over such as
  40.         checking for NIL handles and pointers, but also things that some
  41.         feel are not so much under their control such as QuickDraw and the
  42.         Segment Loader.
  43.         
  44.     2.    What kind of performance can a user expect from the application when
  45.         it is running in the minimum memory configuration? Performance includes
  46.         not only speed in handling data, but also things like how many documents
  47.         can be opened, etc.
  48.         
  49.     3.    What are the typical sizes of scraps [is a boy dog] that a user might
  50.         wish to work with when lauching or switching to your application? If
  51.         the amount of memory is too small, the scrap may get lost [will have
  52.         to be shot]. This can be quite frustrating to the user.
  53.         
  54.     4.    The previous items have concentrated on topics that tend to cause an
  55.         increase in the minimum size to request from MultiFinder. On the flip
  56.         side, however, should be the consideration of what environments the
  57.         application may be running in. There may be a high probability that
  58.         many users with relatively small memory configurations will want to
  59.         avail themselves of your application. Or, many users might want to use it
  60.         while several other, possibly related/complementary applications are
  61.         running. If that is the case, it would be helpful to have a fairly
  62.         small minimum size.
  63.     
  64.     So, what did we decide on Sample? First, Sample has little risk of
  65.     running out of memory once it starts. Second, performance isn't much
  66.     of an issue since it doesn't do much and multiple windows are not
  67.     allowed. Third, there are no edit operations in Sample itself, so we
  68.     just want to provide enough space for a reasonable scrap to survive
  69.     between desk accessory launches. Lastly, Sample should intrude as little
  70.     as possible, so the effort should be towards making it as small as possible.
  71.     We looked at some heap dumps while the application was running under
  72.     various partition sizes. With a size of 23K, there was approximately
  73.     8-9K free, which is a good 'slop' factor in an application like this
  74.     which doesn't do much, but where we'd still like the scrap to survive
  75.     most of the time. */
  76.  
  77. #define kMinSize    128                /* application's minimum size (in K) */
  78.  
  79. /*    We made the preferred size bigger than the minimum size by 12K, so that
  80.     there would be even more room for the scrap, FKEYs, etc. */
  81.  
  82. #define kPrefSize    256                /* application's preferred size (in K) */
  83.  
  84. #define    rMenuBar    128                /* application's menu bar */
  85. #define    rAboutAlert    128                /* about alert */
  86. #define    rUserAlert    129                /* error user alert */
  87. #define    rWindow        128                /* application's window */
  88. #define rStopRect    128                /* rectangle for Stop light */
  89. #define rGoRect        129                /* rectangle for Go light */
  90.  
  91. /* kSysEnvironsVersion is passed to SysEnvirons to tell it which version of the
  92.    SysEnvRec we understand. */
  93.  
  94. #define    kSysEnvironsVersion        1
  95.  
  96. /* kOSEvent is the event number of the suspend/resume and mouse-moved events sent
  97.    by MultiFinder. Once we determine that an event is an osEvent, we look at the
  98.    high byte of the message sent to determine which kind it is. To differentiate
  99.    suspend and resume events we check the resumeMask bit. */
  100.  
  101. #define    kOSEvent                app4Evt    /* event used by MultiFinder */
  102. #define    kSuspendResumeMessage    1        /* high byte of suspend/resume event message */
  103. #define    kResumeMask                1        /* bit of message field for resume vs. suspend */
  104. #define    kMouseMovedMessage        0xFA    /* high byte of mouse-moved event message */
  105. #define    kNoEvents                0        /* no events mask */
  106.  
  107. /* The following constants are used to identify menus and their items. The menu IDs
  108.    have an "m" prefix and the item numbers within each menu have an "i" prefix. */
  109.  
  110. #define    mApple                    128        /* Apple menu */
  111. #define    iAbout                    1
  112.  
  113. #define    mFile                    129        /* File menu */
  114. #define    iNew                    1
  115. #define    iClose                    4
  116. #define    iQuit                    12
  117.  
  118. #define    mEdit                    130        /* Edit menu */
  119. #define    iUndo                    1
  120. #define    iCut                    3
  121. #define    iCopy                    4
  122. #define    iPaste                    5
  123. #define    iClear                    6
  124.  
  125. #define    mLight                    131        /* Light menu */
  126. #define    iStop                    1
  127. #define    iGo                        2
  128. #define iFill                    4
  129.  
  130. /*    1.01 - kTopLeft - This is for positioning the Disk Initialization dialogs. */
  131.  
  132. #define kDITop                    0x0050
  133. #define kDILeft                    0x0070
  134.  
  135. /*    1.01 - kMinHeap - This is the minimum result from the following
  136.     equation:
  137.         
  138.         ORD(GetApplLimit) - ORD(ApplicZone)
  139.         
  140.     for the application to run. It will insure that enough memory will
  141.     be around for reasonable-sized scraps, FKEYs, etc. to exist with the
  142.     application, and still give the application some 'breathing room'.
  143.     To derive this number, we ran under a MultiFinder partition that was
  144.     our requested minimum size, as given in the 'SIZE' resource. */
  145.      
  146. #define kMinHeap                21 * 1024
  147.     
  148. /*    1.01 - kMinSpace - This is the minimum result from PurgeSpace, when called
  149.     at initialization time, for the application to run. This number acts
  150.     as a double-check to insure that there really is enough memory for the
  151.     application to run, including what has been taken up already by
  152.     pre-loaded resources, the scrap, code, and other sundry memory blocks. */
  153.      
  154. #define kMinSpace                8 * 1024
  155.  
  156. /* kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
  157.  
  158. #define kExtremeNeg                -32768
  159. #define kExtremePos                32767 - 1 /* required to address an old region bug */
  160.  
  161. /* these #defines are used to set enable/disable flags of a menu */
  162.  
  163. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  164. #define NoItems        0b0000000000000000000000000000000
  165. #define MenuItem1    0b0000000000000000000000000000001
  166. #define MenuItem2    0b0000000000000000000000000000010
  167. #define MenuItem3    0b0000000000000000000000000000100
  168. #define MenuItem4    0b0000000000000000000000000001000
  169. #define MenuItem5    0b0000000000000000000000000010000
  170. #define MenuItem6    0b0000000000000000000000000100000
  171. #define MenuItem7    0b0000000000000000000000001000000
  172. #define MenuItem8    0b0000000000000000000000010000000
  173. #define MenuItem9    0b0000000000000000000000100000000
  174. #define MenuItem10    0b0000000000000000000001000000000
  175. #define MenuItem11    0b0000000000000000000010000000000
  176. #define MenuItem12    0b0000000000000000000100000000000
  177.